package com.example.carbonbackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.carbonbackend.common.BaseResponse;
import com.example.carbonbackend.model.dto.EGCarbonemissionDto;
import com.example.carbonbackend.model.dto.EUCarbonemissionDto;
import com.example.carbonbackend.model.dto.emission.CarbonEmissionQueryRequest;
import com.example.carbonbackend.model.entity.CarbonEmission;
import com.baomidou.mybatisplus.extension.service.IService;
import com.example.carbonbackend.model.vo.CarbonEmissionVO;

import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;

/**
* @author 25103
* @description 针对表【carbonemission(碳排放表)】的数据库操作Service
* @createDate 2024-03-18 17:35:41
*/
public interface CarbonEmissionService extends IService<CarbonEmission> {

    /**
     * 查找碳排放数据
     */
    String search(String keyword,int year);
    /**
     * 计算碳排放数据
     */
    BaseResponse<String> accountForEG(EGCarbonemissionDto egCarbonemissionDto) throws IOException;

    /**
     * 接收表现层传入的碳排放数据
     */
    BaseResponse<String> inputEG(String name, String year, File file) throws IOException;
    /**
     * 接收表现层传入的碳排放数据
     */
    public BaseResponse<String> inputEU(String name, String year, File file) throws IOException;
    /**
     * 计算碳排放数据
     */
    public BaseResponse<String> accountForEU(EUCarbonemissionDto euCarbonemissionDto) throws IOException;


    /**
     * 获取查询条件
     *
     * @param carbonEmissionQueryRequest
     * @return
     */
    QueryWrapper<CarbonEmission> getQueryWrapper(CarbonEmissionQueryRequest carbonEmissionQueryRequest);

    /**
     * 获取交易记录封装
     *
     * @param carbonEmission
     * @param request
     * @return
     */
    CarbonEmissionVO getCarbonEmissionVO(CarbonEmission carbonEmission, HttpServletRequest request);

    /**
     * 分页获取交易记录封装
     *
     * @param carbonEmissionPage
     * @param request
     * @return
     */
    Page<CarbonEmissionVO> getCarbonEmissionVOPage(Page<CarbonEmission> carbonEmissionPage, HttpServletRequest request);
}
